<!DOCTYPE html>

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8">
    <title>支付</title>
    <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.1.0.js"></script>

</head>
<body>
<h1>支付jsp</h1>
nihaoaaaaaaaaaaaaaaaaaaaaaaaa
<td>orderNumber<input id='orderNumber' type='text'></td><br/>
<td>amount<input id='amount' type='text'></td><br/>
<td>   userId<input id='userId' type='text'></td><br/>
<td>   title<input id='title' type='text'></td><br/>
<td>   description<input id='description' type='text'></td><br/>
<button type="button" onclick="mySave()">支付</button>

</body>

<script>
    function mySave() {
        var JSONObject = {
            "orderNumber": $("#orderNumber").val()
            , "amount": $("#amount").val()
            , "userId": $("#userId").val()
            , "title": $("#title").val()
            , "description": $("#description").val()
        };
        $.ajax({
            type: "POST",
//            url: location.protocol + '//' + location.host + "/user/item/1",
            url:"http://localhost:8080/unionpay/pay",
            data: JSONObject,
            dataType: "json",
            success: function (data) {
                if ( data.code === '201' ){
                    alert(data.data.data);
                    var  result = data.data.data;
                    $("body").html(result);
                }else{
                    alert(data.code);
                }
            }
        });
    }
</script>


</html>
